{% macro paramList(params, truncateLines) -%}
  {%- if params -%}
    ({%- for param in params -%}
      {$ param | escape | truncateCode(truncateLines) $}{% if not loop.last %}, {% endif %}
    {%- endfor %})
  {%- endif %}
{%- endmacro -%}


{% macro returnType(returnType) -%}
  {%- if returnType %}: {$ returnType | escape $}{% endif -%}
{%- endmacro -%}

{%- macro renderParameters(parameters, containerClass, parameterClass, showType) -%}
{%- if parameters.length -%}
<table class="is-full-width list-table parameters-table {$ containerClass $}">
  <tbody>
  {% for parameter in parameters %}
    <tr class="{$ parameterClass $}">
      <td class="param-name"><a id="{$ parameter.anchor $}"></a>{$ parameter.name $}</td>
      {% if showType %}<td class="param-type"><code>{$ parameter.type $}</code></td>{% endif %}
      <td class="param-description">
      {% marked %}
        {% if parameter.isOptional or parameter.defaultValue !== undefined %}Optional. Default is `{$ parameter.defaultValue === undefined and 'undefined' or parameter.defaultValue $}`.{% endif %}

        {% if parameter.description | trim %}{$ parameter.description $}
        {% elseif not showType and parameter.type %}<p>Type: <code>{$ parameter.type $}</code>.</p>
        {% endif %}
      {% endmarked %}
      </td>
    </tr>{% endfor %}
  </tbody>
</table>
{%- else -%}
<p>There are no parameters.</p>
{%- endif -%}
{%- endmacro -%}